package com.example.klaraservice.controller;

import com.example.klaraservice.dao.AddressMapper;
import com.example.klaraservice.dao.BrandMapper;
import com.example.klaraservice.pojo.Address;
import com.example.klaraservice.pojo.Brand;
import com.example.klaraservice.vo.R;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.Date;
import java.util.List;

/**
 * @author : Glacialerisa
 * @date : 2023/5/28 14:45
 * @desc :
 */
@Api(tags = "测试")
@RestController
@RequestMapping("/api/test")
public class TestController {
    @Resource
    private BrandMapper comBrandMapper;
    @Resource
    private AddressMapper addressMapper;
    @ApiOperation("测试接口")
    @GetMapping("/1")
    public R test(){
        return R.ok().data("message", "hello").data("now", new Date());
    }

    @GetMapping("/list")
    public R list(){
//        List<Brand> list = comBrandMapper.selectAllComBrand();
//        return R.ok().data("comBrand", list);
        return null;
    }
    @RequestMapping("/address")
    public R addAddress(@RequestBody Address address,@RequestParam int userId){
        boolean b = addressMapper.addAddress(address,userId);
        return R.ok().data("222", b);
    }
}
